<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./jquery.min.js"></script>
    <style>
      div {
        width: 100px;
        height: 100px;
        background-color: hotpink;
      }
    </style>
  </head>
  <body>
    <button class="btn_stop">停止</button>
    <button class="btn_start">开始</button>

    <div></div>

    <script>
      $(function () {
        function go() {
          $('div').animate(
            {
              width: '200px',
              height: '200px',
            },
            3000
          )
        }

        go()

        $('.btn_stop').on('click', function () {
          $('div').stop()
        })

        $('.btn_start').on('click', function () {
          go()
        })
      })
    </script>
  </body>
</html>
